home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / qcmp114.zip / QCMP.DOC < prev    next >
Text File  |  1991-01-23  |  13KB  |  317 lines

  1.                                    QCMP 1.14
  2.                                    ---------
  3.  
  4.         Purpose
  5.         -------
  6.         QCMP compares two files, or two groups of files.  It is not
  7.         designed to isolate file differences, but simply to tell you
  8.         whether or not files are identical.  This can be used to verify
  9.         file-by-file backup operations, for smart batch files, in
  10.         Personal REXX programs, etc.  QCMP is similar to DOS's COMP
  11.         command except that (1) it doesn't display differences; (2) the
  12.         display is better suited for automated processing; and (3) it
  13.         returns a usable errorlevel.
  14.  
  15.         Version 1.13 adds SHARE support but makes no other changes.
  16.  
  17.         | indicates changes in recent versions.
  18.  
  19.  
  20.         Usage
  21.         -----
  22.         Here is the syntax for running QCMP:
  23.  
  24.             qcmp filespec1 filespec2 [-Dn] [-H] [-T]
  25.  
  26.         Usage is largely the same as DOS's COMP command except that
  27.         QCMP does not prompt for missing input, and the three option
  28.         switches are not found in COMP.  The optional switches can be
  29.         introduced by either a hypen (-) or a slash (/).
  30.  
  31.         Filespec1 can be any valid file or directory specification:
  32.  
  33.             d:                  Drive only
  34.             path                Path only
  35.             d:file.ext          Drive, filename, extension
  36.             path\file.ext       Path, filename, extension
  37.             d:path\file.ext     Drive:path. filename, extension
  38.  
  39.         If no drive is specified, the current drive is assumed.  If no
  40.         path is specified, the current directory for the selected
  41.         drive is assumed.
  42.  
  43.         If no filename is specified, "*.*" (all files) is assumed.
  44.  
  45.         If no extension is specified, "*" is assumed.  If you really
  46.         want to check a file that has no extension, use a single "."
  47.         with no extension.  For example, "foo" is assumed to be "foo.*",
  48.         but "foo." matches only a file called "foo" (not "foo.txt").
  49.  
  50.         Filespec2 is identical to filespec1 except that a missing
  51.         filename will default to the filename used in filespec1 rather
  52.         than "*.*".
  53.  
  54.         Examples:
  55.  
  56.             qcmp *.* b:
  57.                 Compare all files in current directory of current drive
  58.                 with files of the same name on drive B:
  59.  
  60.             qcmp a: b:
  61.                 Compare all files on drive A: to same files on drive B:.
  62.  
  63.             qcmp \asm\*.asm b:*.bak
  64.                 Compare all *.ASM files in \ASM directory of current
  65.                 drive to files with same root name but .BAK extension on
  66.                 drive B.
  67.  
  68.  
  69.         Display levels
  70.         --------------
  71.         The -D (Display level) switch affects the results messages that
  72.         are displayed.  Valid display levels are:
  73.  
  74.             -D0     No display; return errorlevel only.
  75.             -D1     Display results only for comparison errors
  76.             -D2     Display results for all files compared
  77.  
  78.         The -D0 level is intended for batch files and Personal REXX
  79.         programs (or other programs that can execute QCMP and examine
  80.         the result code).  The -D2 level is the default.
  81.  
  82.  
  83.         Checking the timestamp
  84.         ----------------------
  85.         If two files have identical contents, QCMP will normally
  86.         consider them to be the same even if their dates or times
  87.         differ.  However, if you use the -T switch, QCMP will also
  88.         compare the files' modification dates and times; if they are
  89.         different, the files are reported as being different, even if
  90.         their contents are the same.
  91.  
  92.  
  93.         Including hidden files
  94.         ----------------------
  95.         If you want to include hidden files such as IBMBIO.COM in your
  96.         comparisons, add the -H switch.  For example,
  97.  
  98.             qcmp -h c:\*.* b:
  99.  
  100.         would compare all of the files in the root directory of drive C
  101.         with copies on drive B, including hidden files (possibly,
  102.         IBMBIO.COM and IBMSYS.COM).  Without the -H, hidden files would
  103.         not be included.
  104.  
  105.  
  106.         Results (display)
  107.         -----------------
  108.         For each matching file, QCMP will display the following line:
  109.  
  110.             filespec1 - filespec2 > result
  111.  
  112.         where FILESPEC1 and FILESPEC2 are the two files currently being
  113.         compared, and RESULT is the comparison result.  RESULT is one of
  114.         the following:
  115.  
  116.             OK                  Files are identical
  117.             ERROR               Files are same size but not identical
  118.             SIZE DIFF           Files are different sizes
  119.             READ ERROR          Error reading one of the files.
  120.             DATE/TIME DIFF      Files' timestamps are different (this
  121.                                 error reported only if -T selected)
  122.             <file> NOT FOUND    Named file not found
  123.  
  124.         Note that the -D1 display level suppresses the display of files
  125.         for which the result is "OK".
  126.  
  127.  
  128.         Results (errorlevel)
  129.         --------------------
  130.         QCMP returns an errorlevel to DOS that describes the comparison
  131.         results.  Errorlevel are as follows:
  132.  
  133.             0       All files are identical (all "OK")
  134.             1       At least one comparison failed
  135.             254     No files found matching first filespec
  136.             255     Usage error, disk error, or insufficient memory
  137.  
  138.         Note that if you specify the -d0 display level, ONLY the error
  139.         level is returned; there is no display at all.  When -d0 is
  140.         specified, QCMP will terminate as soon as an errorlevel is
  141.         determined; for example, it will not bother to continue
  142.         comparing more files after one comparison fails, because the
  143.         errorlevel must be 1 regardless of the results of subsequent
  144.         comparisons.
  145.  
  146.  
  147.         Sample use: batch files
  148.         -----------------------
  149.         1. Branch to BACKUP if any *.ASM file in current drive is not
  150.         preperly backed up to B:*.BAK, else continue.
  151.  
  152.             qcmp -d0 *.asm b:*.bak
  153.             If errorlevel 255 goto QCERR
  154.             If errorlevel 254 goto NOFILES
  155.             If errorlevel 1 goto BACKUP
  156.             ... (all files OK)
  157.             ...
  158.             :BACKUP
  159.             ... (needs backup)
  160.             ...
  161.             :NOFILES
  162.             ... (no files match filespec1)
  163.             :QCERR
  164.             ... (error in qcmp, or no matching files)
  165.             ...
  166.  
  167.         2. Back up any file in current directory that needs backup to
  168.         drive B.  This requires two batch files, one called by the other
  169.         using the technique of executing another copy of COMMAND.COM
  170.         with the second batch file as a parameter.
  171.  
  172.             BAK.BAT:
  173.                 FOR %%a IN (*.*) DO command /c xxbak %%a
  174.  
  175.             XXBAK.BAT:
  176.                 qcmp -d0 %1 b:
  177.                 IF NOT errorlevel 1 GOTO OK
  178.                 echo Backing up %1
  179.                 copy %1 b:
  180.                 GOTO exit
  181.                 :OK
  182.                 echo %1 is backed up
  183.                 :EXIT
  184.  
  185.  
  186.         Sample use: Personal REXX
  187.         -------------------------
  188.         1. Determine whether all files in current directory were
  189.         backed up successfully to drive b:
  190.  
  191.             'qcmp -d0 *.* b:'
  192.             If rc = 0 Then
  193.                 Say 'All files backed up OK'
  194.             Else If rc = 1 Then
  195.                 Say 'Error in backup!'
  196.             Else If rc = 254 Then
  197.                 Say 'No Matching files'
  198.             Else If rc = 255 Then
  199.                 Say 'qcmp error!'
  200.  
  201.         2. Create a list of files that need to be backed up from the
  202.         current directory of drive C to drive B, and back them all up.
  203.         The sample code assumes that STACKDRV and STACKMGR are
  204.         installed; without the STK device, the same could be accomplised
  205.         by redirecting output to a temporary file, reading the file line
  206.         by line, and then deleting the file.
  207.  
  208.             'qcmp c: b: > stk'
  209.             If rc > 1 Then Do
  210.